import axios from 'axios';

axios.interceptors.response.use(res => {
  return res.data
})

window.DEBUGGING = -1 < location.href.indexOf('8080')
// window.DEBUGGING = false


if(window.DEBUGGING) {
  new Promise((resolve) => {
    resolve({
      userName: '???',
      userAvatar: 'https://juwairenimg.oss-cn-hangzhou.aliyuncs.com/Face/faceimg_6341_200.jpg?x-oss-process=image/resize,w_70&&token=1536031775267'
    })
  }).then((res) => {
    window.IS_LOGINED = true;
    window.USER_INFO = res;
  })
} else {
  axios.post('/Points/UserPoints').then(function(res) {
    if(res.msg == "success") {
      window.IS_LOGINED = true;
      window.USER_INFO = res.data;
    } else {
      window.IS_LOGINED = false;
      window.USER_INFO = {}
      // location.href = "/login.html"
    }
    console.log(window.IS_LOGINED);
  })
}

// if (!window.IS_LOGINED) {
//   return location.href = "/login.html";
// }

